"""
取一份原始数据，留出每个合约后20%的数据作为验证
"""
import pandas as pd

secs = ["i", "FG", "MA", "TA", "ru", "ss", "ni", "eb"]

all_train = []
for sec in secs:
    df = pd.read_csv(f"D:\daily work\ml\\raw\\{sec}_prices.csv")
    n = int(df.shape[0] * 0.7)
    train_data = df[:n]
    test_data = df[n:]
    train_data.drop(
            ["datetime", "close", "high", "low", "open", "volume", "open_interest", "wh_ind", "date", "time", "symbol"], axis=1, inplace=True)
    all_train.append(train_data)
    test_data.to_csv(f"D:\daily work\ml\\test\\test_data\\{sec}_test8.csv", index=False)

train_df = pd.concat(all_train)
train_df.to_csv(f"D:\daily work\ml\\test\\train_data8.csv", index=False)
